package com.app.controller;


import com.app.entity.Orders;
import com.app.entity.Subject;
import com.app.service.OrderService;
import com.app.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zxy
 * @since 2021-04-07
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @RequestMapping("/token/seeStudent")
    public Result seeStudent(@RequestParam("subid") Integer subid) {
        return orderService.seeStudent(subid);
    }


    /**
     * 学员查询订单
     *
     * @param type
     * @return
     */
    @RequestMapping("/token/findOrdersAndCoach")
    public Result findOrdersAndCoach(@RequestParam("type") Integer type) {
        return orderService.findOrdersAndCoach(type);
    }

    /**
     * 教练通过学时审核
     */
    @RequestMapping("/token/endPractice")
    public Result endPractice(@RequestParam("id") Integer id) {
        return orderService.endPractice(id);
    }

    /**
     * 学员提交评价
     */
    @RequestMapping("/token/submitPinJia")
    public Result submitPinJia(@RequestBody() Orders orders) {
        return orderService.submitPinJia(orders);
    }

    /**
     * 查询评价
     */
    @RequestMapping("/token/findEvaluateByStudent")
    public Result findEvaluateByStudent() {
        return orderService.findEvaluateByStudent();
    }
    /**
     * 查看学时完成进度
     */
    @RequestMapping("/token/findSurplusHour")
    public Result findSurplusHour() {
        return orderService.findSurplusHour();
    }

    /**
     * 教练查询用户对他的评价
     */
    @RequestMapping("/token/findOrdersByCoach")
    public Result findOrdersByCoach() {
        return orderService.findOrdersByCoach();
    }


    /**
     * 管理员查看评论用户评论详情
     */
    @RequestMapping("/token/findAllOrderByAdmin")
    public Result findAllOrderByAdmin() {
        return orderService.findAllOrderByAdmin();
    }
}

